package ex55.mm.flow.impound.quote.aggregate;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.lang.Nullable;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class OnePathRst {
    // pathId
    public String pathId;
    // 法币兑换路径是否成功
    public boolean pathSuccess = true;
    // 创建时间
    public Date created_at = new Date();
    // 法币兑换过程中需要消耗的成本比例
    public BigDecimal costRate = BigDecimal.ZERO;
    // 基础资产（例：BTC)
    public String baseCurrency;
    // 计价资产（例：USDT)
    public String quoteCurrency;
    public String source;
    public String target;
    // 资产转换节点的权重
    public BigDecimal tradeWeight;
    // 兑换交易次数
    public int tradeCount = 0;
    // 交易路径列表
    public List<ExEdge> path;
    // 交易节点列表
    public List<TradeEdgeRst> tradeEdge = new ArrayList<>();
    // 法币兑换过程中最大能够兑换的USD的量
    @Nullable
    public BigDecimal availableTradeAmount = null;

    /** 兑换比例 */
    @Nullable
    public BigDecimal convertRate = null;

    public String breakKey = "";
    public String breakMessage = "";

    public void breakPath(String breakKey, String breakMessage) {
        this.pathSuccess = false;
        this.breakKey = breakKey;
        this.breakMessage = breakMessage;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
